package com.lmk;

import java.security.SecureRandom;
import java.util.Scanner;

public class Main {
    static Scanner sc=new Scanner(System.in);


    public static void main(String[] args) {
        System.out.println("=======欢迎光临======");

        int a=(int)(Math.random()*100); //一个0-99随机数
      int w=0;
        SecureRandom random=new SecureRandom();
        boolean repeat=true;


        while (repeat){
            int target=random.nextInt(100);
            //System.out.println(a);
            boolean pass=false;
            while (!pass){
                System.out.println("请输入一个0-100的整数");

                int n=sc.nextByte();

                if(n>a) {
                    System.out.println("太大了");w++;
                }else if(n<a){
                    System.out.println("太小了");w++;
                } else {
                    System.out.println(w+" 次答对了");
                    pass=true;
                }

            }
            System.out.println("再来一句吗？(y/n)");
            String  str=sc.next();
            if("n".equals(str)){
                repeat=false;
            }
        }


        System.out.println("========欢迎光临=====");
    }

}
